@using Orchard.ContentManagement;
@using Orchard.Mvc.Extensions;
@{
    // TODO: It'd be good to simplify this for players and themes that need to override it (so e.g. the width, height, format etc. get automated
    // according to the normal template)
    IHtmlString embedRender = null;
    MediaGarden.Models.IMediaItem item = Model.MediaItem;
    IContent content = item as IContent;
}
@if (content != null)
{
    var contentId = content.Id;
<div class="media-embed">
@*
    @using(var c=Capture(captured=>{ embedRender=captured; })) {@Display.Media(MediaItem: Model.MediaItem, Width: 640, Height: 480, PlaylistFormat:"Default")}
    // TODO: Link back to site
    *@
    @using (var c = Capture(captured => { embedRender = captured; })) {<iframe src="@Url.AbsoluteAction("Embed", "Embedding", new { id = contentId, area = "MediaGarden", width = 640, height = 480 })" webkitAllowFullScreen allowFullScreen></iframe>}
    <h2>Embed</h2>
    <form>
        <textarea class="media-embed-code" cols="20" rows="5" readonly="true">@embedRender.ToString()</textarea>
    </form>
</div>
}